Skip to content

fix: token info retrieval in Info and readme - #277

Open
vagetablechicken wants to merge 1 commit into
hyperliquid-dex:masterfrom
vagetablechicken:dev/info
Open

fix: token info retrieval in Info and readme#277
vagetablechicken wants to merge 1 commit into
hyperliquid-dex:masterfrom
vagetablechicken:dev/info

Conversation

@vagetablechicken

Copy link
Copy Markdown
  • The Issue: The universe tokens were being accessed via list position, but the API's list index and the token's internal index are not always 1:1.

    The Fix: Implemented a token_index_to_token_info lookup table to map metadata by the actual token ID.

  • Homebrew paths for specific versions (like 3.10.16) change whenever the patch version updates. Using brew --prefix ensures the command remains valid even after brew upgrade, preventing broken environment setups.

fix #275

@koriyoshi2041 koriyoshi2041 left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Validated the mapping change at exact head bc81bdfb294861e065f3eed132ea8acb37bc797a against the current testnet response.

The live spotMeta payload currently has 1,645 token records and 1,309 universe entries. 57 universe entries reference token IDs that are outside the token array's positional bounds, while every referenced ID is present in the tokens' internal index field. With this patch, Info(skip_ws=True, meta=..., spot_meta=...) initializes successfully and maps the response; the existing tests/info_test.py suite passes 23/23 and the diff check is clean.

So the ID-keyed lookup is the right semantic fix and the original failure remains live. This PR is currently conflicting with the target branch, though, and the code change has no regression fixture for a non-contiguous token ID. Before merge, please rebase and add a small Info test where a universe entry references a valid internal token index greater than len(tokens) - 1. It would also be cleaner to separate the unrelated README environment edit while resolving the conflict.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

testnet API returns invalid token indices causing IndexError

2 participants